package com.disktalk.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.disktalk.service.DiskFileService;
@Controller
public class TestUploadController {
	private final DiskFileService diskFileService;
	@Autowired
	public TestUploadController(DiskFileService diskFileService) {
		this.diskFileService = diskFileService;
	}

	ModelAndView model = new ModelAndView();
	@RequestMapping(value = "/upload", method = RequestMethod.POST)
	public ModelAndView upload(HttpServletRequest request,HttpServletResponse response) throws Exception{   
		boolean msg  = diskFileService.uploadFile(request);
		model.setViewName("groupUser");
		model.addObject("msg", msg);
		return model;
		}


}
